package edu.towson.cosc603.coffeemaker;

//import static org.junit.Assert.*;
import junit.framework.TestCase;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

public class InventoryTest extends TestCase{
	Inventory i;
	int coffee;
	int sugar;
	int milk;
	int chocolate;
	Recipe r1;
	
	
	@Before
	public void setUp() throws Exception {
		i = new Inventory();
	}
	
	@After
	public void tearDown() throws Exception {
	}
	
	@Test
	public void testCofee() {
		i.setCoffee(2);
		assertEquals(2, i.getCoffee() );
		
		i.setCoffee(-1);
		assertEquals(0, i.getCoffee() );
	}
	
	@Test
	public void testSugar() {
		i.setSugar(2);
		assertEquals(2, i.getSugar() );
		
		i.setSugar(-1);
		assertEquals(0, i.getSugar() );
	}
	
	@Test
	public void testMilk() {
		i.setMilk(2);
		assertEquals(2, i.getMilk() );
		
		i.setMilk(-1);
		assertEquals(0, i.getMilk() );
	}
	
	@Test
	public void testChocolate() {
		i.setChocolate(2);
		assertEquals(2, i.getChocolate() );
		
		i.setChocolate(-1);
		assertEquals(0, i.getChocolate() );
	}
	
	@Test
	public void testString() {
		i.setChocolate(1);
		i.setMilk(1);
		i.setSugar(1);
		i.setCoffee(1);
		
		assertEquals( "Coffee: 1\n" +
				"Milk: 1\n" +
				"Sugar: 1\n" +
				"Chocolate: 1\n" , i.toString());
		
	}
	
	@Test
	public void testEnoughIngridients () {
		r1 = new Recipe();
		r1.setName("R1");
		r1.setPrice(1);
		r1.setAmtCoffee(1);
		r1.setAmtMilk(1);
		r1.setAmtSugar(1);
		r1.setAmtChocolate(1);
		
		assertTrue( i.enoughIngredients(r1));
		
		r1.setPrice(30);
		r1.setAmtCoffee(30);
		r1.setAmtMilk(30);
		r1.setAmtSugar(30);
		r1.setAmtChocolate(30);
		assertFalse( i.enoughIngredients(r1));
	}

}
